package one.stand.service.impl;

import one.stand.config.CardPosterConfig;
import one.stand.config.ComponentConfig;
import one.stand.config.GlobalConfig;
import one.stand.config.WxUrlConfig;
import one.stand.mapper.CollectionMapper;
import one.stand.service.BaseService;
import one.stand.service.SunCodeService;
import one.stand.service.WxPayService;
import one.stand.util.ImageGenerateUtil;
import one.stand.util.OssUtil;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author: QIK
 * @CreateDate: 2019/4/29 11:34
 */
public class PublicBaseService extends BaseService {
    /**
     * 缓存两小时
     */
    protected static final Integer LOGIN_TIME_LONG = 7000;

    /**
     * 缓存七天
     */
    protected static final Integer LOGIN_TIME_FOR_7_DAY_LONG = 7;

    /**
     * 成功标示
     * */
    protected static final String SUCCESS = "SUCCESS";

    /**
     * 支付备注（可配）
     * */
    protected static final String body = "商品购买";

    /**
     * 名片太阳码路径
     */
    protected static final String cardSunCode = "pages/index/main";

    /**
     * 商品太阳码路径
     */
    protected static final String goodsSunCode = "pages/prodDetail/main";

    /**
     * 动态太阳码路径
     */
    protected static final String dynamicSunCode = "pages/dynamicDetail/main";
    /**
     * crm邀请加入企业
     */
    protected static final String crmJoinCompany = "pages/companyInvite/main";

    @Autowired
    protected ComponentConfig componentConfig;

    @Resource
    protected OssUtil ossUtil;

    @Autowired
    protected WxPayService wxPayService;

    @Autowired
    protected WxUrlConfig wxUrlConfig;

    @Autowired
    protected GlobalConfig globalConfig;

    @Autowired
    protected SunCodeService sunCodeService;

    @Autowired
    protected CardPosterConfig cardPosterConfig;

    @Autowired
    protected ImageGenerateUtil imageGenerateUtil;

    @Autowired
    protected CollectionMapper collectionMapper;

    protected String getMoneyString(Integer money) {
        BigDecimal a = new BigDecimal(money);
        BigDecimal b = new BigDecimal(100);
        return a.divide(b, 2, RoundingMode.HALF_UP).toString();
    }


}
